<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>中国福利彩票</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">

<!--页面样式-->
<link rel="stylesheet" type="text/css" href="css/style.css" />

</head>
<body  style="width:10rem !important; margin:0 auto">
<script>
/*取设备宽度*/
	function rem(){
	var iWidth=document.documentElement.getBoundingClientRect().width;
	iWidth=iWidth>640?640:iWidth;
	document.getElementsByTagName("html")[0].style.fontSize=iWidth/10+"px";
	};
	rem();
	window.onorientationchange=window.onresize=rem      
</script>
<script src="js/jquery-1.7.2.min.js"></script>
    <div class="Header">
<!--     	<div class="left H_logot"><a href="MemberCenter.html"><img src="images/Nimg5.png"></a></div> -->
        <div class="left H_content text-center font28 cfffff">大奖兑奖</div>
        <div class="right H_right text-right font24"><a href="MemberCenter.html"><img src="images/Nimg4.png"></a></div>
        <div class="clear"></div>
    </div>
    
    <div class="MD_xuzhi paddingB60">
    	<div class="MDD_one font24 c333333">
        	<ul>
            	<li class="font28 cf00015 fist">姓名：<span id="name"></span></li>
                <li><span class="c999999">游戏：<span id="gameCode"></span></li>
                <li><span class="c999999">期号：<span id="periodNum"></span></li>
                <li><span class="c999999">身份证号：<span id="idCard"></span></li>
                <li><span class="c999999">银行卡号：<span id="bankCard"></span></li>
                <li class="last">
                	<span class="c999999 L_left left">中奖信息：</span>
                	<span class="right L_right" id="prizeInfo"></span>
                    <div class="clear"></div>
                </li>
                <li><span class="c999999">税前奖金（元）：<span id="pretax"></span></li>
                <li><span class="c999999">个人所得税（元）：<span id="paytax"></span></li>
                <li><span class="c999999">税后奖金（元）：<span id="aftertax"></span></li>
                <li><span class="c999999">订单号：<span id="orderNo"></span></li>
            </ul>
        </div>
        
        <div class="FPWD_1">
        	<input type="submit" value="确认兑奖" class="FPWD_but font32 cfffff Weiruan marginT80" onclick="award()"/>
        </div>
    </div>
    
</body>
<script type="text/javascript">
var orderNo="";//TODO 订单号还不知道怎么获取
var accountId="";
$(document).ready(function() {
	accountId = getCookie("accountId");
	getPrizeInfo();
});
//调用“一类兑奖接口”查询中奖信息
function getPrizeInfo(){
	 var para = {
			 accountId:accountId,
			 orderNo:orderNo
// 			 accountId:"2221322240000",
//  			 orderNo:"91703944442679296"
	        };
		
		$.ajax({
			url : "../../api/accountSystem/abigprizewininfo",
			async:false,
			type : "POST",
			herder:{
				'Accept':'application/json',
				'Content-Type':'application/json'
			},
			dataType:"json",
			contentType:"application/json",
			data: JSON.stringify(para),
			error:function(XMLHttpRequest, textStatus, errorThrown){
				alert(errorThrown);
			},
			success: function(data, textStatus){
				if(data.success == true){
					$('#name').html(data.name);//名字
					$('#gameCode').html(data.gameCode);//游戏
					$('#periodNum').html(data.periodNum);//期号
					$('#idCard').html(data.idCard);//身份证号
					$('#bankCard').html(data.bankCard);//银行卡
					$('#prizeInfo').html(data.prizeInfo);//中奖信息
					$('#pretax').html(data.pretax);//税前奖金
					$('#paytax').html(data.paytax);//个人所得税
					$('#aftertax').html(data.aftertax);//税后奖金
					$('#orderNo').html(data.orderNo);//订单号
				}else{
					alert(data.description);
					return;
				}
			}		
		});
}
//点击“兑奖”
function award(){
	 var para = {
			 accountId:accountId,
			 orderNo:orderNo
// 			 accountId:"2221322240000",
//  			 orderNo:"91703944442679296"
	        };
		
		$.ajax({
			url : "../../api/accountSystem/acceptTheAward",
			async:false,
			type : "POST",
			herder:{
				'Accept':'application/json',
				'Content-Type':'application/json'
			},
			dataType:"json",
			contentType:"application/json",
			data: JSON.stringify(para),
			error:function(XMLHttpRequest, textStatus, errorThrown){
				alert(errorThrown);
			},
			success: function(data, textStatus){
				if(data.success == true){
					window.location.href='Mdjdh1Win.html';
				}else{
					window.location.assign(encodeURI('Mdjdh1Down.html?description='+data.description+''));
					return;
				}
			}		
		});
}
</script>
<script src="js/jsCallCookies.js"></script>
<script src="js/SHA256.js"></script>
<script src="js/validation.js"></script>
</html>
